﻿
<MudRTLProvider RightToLeft="@SharedLayoutSettings.IsRTL">
	<MudDialog>
		<TitleContent>
			<MudText Typo="Typo.h6">
				<MudIcon Icon="@Icons.Material.Filled.Logout" Class="mr-3 mb-n1" />
				@DashboardResource.StringLogoutConfirmation
			</MudText>
		</TitleContent>
		<DialogContent>
			<MudText>@ContentText</MudText>
		</DialogContent>
		<DialogActions>
			<MudButton OnClick="Submit" Color="@SubmitButtonColor" StartIcon="@Icons.Material.Filled.Logout" IconColor="Color.Surface" Variant="Variant.Filled">
				@DashboardResource.StringLogout
			</MudButton>
			<MudButton OnClick="Close" Variant="Variant.Filled" Color="Color.Primary" StartIcon="@Icons.Material.Filled.FreeCancellation" IconColor="Color.Surface">@DashboardResource.StringCancel</MudButton>
		</DialogActions>
	</MudDialog>
</MudRTLProvider>

@code {

	[CascadingParameter]
	MudDialogInstance MudDialog { get; set; }

	[Parameter]
	public string ContentText { get; set; }

	[Parameter]
	public Color SubmitButtonColor { get; set; }

	async Task Submit()
	{
		await AuthenticationStateProvider.Logout();
		Navigation.NavigateTo("/login");
		MudDialog.Close(DialogResult.Ok(true));
	}

	private void Close() => MudDialog.Cancel();
}
